//
//  ZCinvolvedprogressCell.m
//  zctx
//
//  Created by apple on 15/12/28.
//  Copyright © 2015年 sanliang. All rights reserved.
//

#import "ZCinvolvedprogressCell.h"

@implementation ZCinvolvedprogressCell


+(instancetype)cellWithinvolvedprogressCell:(UITableView *)tableView{
    
    static NSString *IDcell = @"progressCell";
    ZCinvolvedprogressCell *cell = [tableView dequeueReusableCellWithIdentifier:IDcell];
    if (!cell) {
        cell = [[ZCinvolvedprogressCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:IDcell];
    }
    return cell;
}

- (void)awakeFromNib {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    self.weight1.constant = (SCREEN_WIDTH-18*2-20*4)/3;
    self.weight2.constant = (SCREEN_WIDTH-18*2-20*4)/3;
   
    self.jian1.constant = ((SCREEN_WIDTH-18*2-20*4)/3)/2;
    self.jian2.constant = ((SCREEN_WIDTH-18*2-20*4)/3)/2;
    self.jian3.constant = ((SCREEN_WIDTH-18*2-20*4)/3)/2;
    
    self.line1.backgroundColor = MainColor;
    
    self.lable1.textColor = [UIColor colorWithHexString:@"#03ab9e"];
    self.lable2.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
    self.lable3.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
    self.lable4.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
    
}

-(void)setModel:(ZCInvolvedDetailsModelContent *)model{
    _model = model;

    // stateInt 0 审核中 1众筹中 2 抽样中 3完成 4 异常
    if ([model.result isEqualToString:@"0"]) {
        //未知
        if ([model.state isEqualToString:@"1"] || [model.state isEqualToString:@"0"]){
            self.line2.backgroundColor = [UIColor colorWithHexString:@"#b2b2b2"];
            self.line3.backgroundColor = [UIColor colorWithHexString:@"#b2b2b2"];
            self.line4.backgroundColor = [UIColor colorWithHexString:@"#b2b2b2"];
            self.line5.backgroundColor = [UIColor colorWithHexString:@"#b2b2b2"];
            self.line6.backgroundColor = [UIColor colorWithHexString:@"#b2b2b2"];
            
            self.lable2.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
            self.lable3.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
            self.lable4.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
            
            self.image2.image = [UIImage imageNamed:@"projectdetail_progress_no"];
            self.image3.image = [UIImage imageNamed:@"projectdetail_progress_no"];
            self.image4.image = [UIImage imageNamed:@"projectdetail_progress_no"];
            
        }else{
            self.line2.backgroundColor = MainColor;
            self.line3.backgroundColor = MainColor;
            self.line4.backgroundColor = MainColor;
            self.line5.backgroundColor = MainColor;
            self.line6.backgroundColor = [UIColor colorWithHexString:@"#b2b2b2"];
            
            self.lable2.textColor = [UIColor colorWithHexString:@"#03ab9e"];
            self.lable3.textColor = [UIColor colorWithHexString:@"#03ab9e"];
            self.lable4.textColor = [UIColor colorWithHexString:@"#b2b2b2"];
            
            self.image2.image = [UIImage imageNamed:@"projectdetail_progress_yes"];
            self.image3.image = [UIImage imageNamed:@"projectdetail_progress_yes"];
            self.image4.image = [UIImage imageNamed:@"projectdetail_progress_no"];
            
        }
    }else{
        self.line2.backgroundColor = MainColor;
        self.line3.backgroundColor = MainColor;
        self.line4.backgroundColor = MainColor;
        self.line5.backgroundColor = MainColor;
        self.line6.backgroundColor = MainColor;
        
        self.lable2.textColor = [UIColor colorWithHexString:@"#03ab9e"];
        self.lable3.textColor = [UIColor colorWithHexString:@"#03ab9e"];
        self.lable4.textColor = [UIColor colorWithHexString:@"#03ab9e"];
        
        self.image2.image = [UIImage imageNamed:@"projectdetail_progress_yes"];
        self.image3.image = [UIImage imageNamed:@"projectdetail_progress_yes"];
        self.image4.image = [UIImage imageNamed:@"projectdetail_progress_yes"];
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
